
from CardsTools import CardsTools
import io


class CardsMain:
    cardsTools = None

    def __init__(self) -> None:
        self.cardsTools = CardsTools()
        self.cardsTools.show_menu()
        self.run()
        pass

    def run(self):
        while (True):
            action_str = input('请选择操作类型:')
            if action_str in ['1', '2', '3']:
                if action_str == '1':
                    self.cardsTools.new_card()
                    pass
                elif action_str == '2':
                    self.cardsTools.show_all()
                    pass
                elif action_str == '3':
                    self.cardsTools.search_card()
                    pass
                pass
            elif action_str == '0':
                print('退出程序')
                break
            else:
                print('输入错误')
            self.cardsTools.show_menu()


cardsMain = CardsMain()
